package com.example.fufudamowang.activity;

import android.app.Activity;
import android.os.Bundle;

import android.view.View;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Toast;

public class MainActivity extends Activity {
    RadioButton Ra = null;
    RadioButton Rb = null;
    RadioButton Rc = null;
    RadioButton Rd = null;
    RadioGroup radioGroup = null;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        radioGroup = (RadioGroup) findViewById(R.id.RadioGroup);
        Ra = (RadioButton) findViewById(R.id.Ra);
        Rb = (RadioButton) findViewById(R.id.Rb);
        Rc = (RadioButton) findViewById(R.id.Rc);
        Rd = (RadioButton) findViewById(R.id.Rd);
        Ra.setClickable(true);
        Button Ba = (Button) findViewById(R.id.Ba);
        Button Bb = (Button) findViewById(R.id.Bb);
        Ba.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
               if (Ra.isChecked())
               {
                   Toast.makeText(MainActivity.this,"你答对了",Toast.LENGTH_SHORT).show();

               }
               else
               {
                   Toast.makeText(MainActivity.this,"你答错了",Toast.LENGTH_SHORT).show();
               }

            }
        });
        Bb.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    finish();

            }
        });
    }
}
